package models

import "tuowei.com/common/models"

type SysExercises struct {
	models.Model
	Name                      string `json:"name" comment:"题库名称"`
	Description               string `json:"description" comment:"描述"`
	Type                      string `json:"type" comment:"类型"`
	Cover                     string `json:"cover" gorm:"varchar(255);comment:题库封面"`
	Subject                   string `json:"subject" comment:"科目"`
	SingleChoiceCount         int    `json:"single_choice_count" gorm:"type:int(5);default:0;comment:单选总数"`
	MultipleChoiceCount       int    `json:"multiple_choice_count" gorm:"type:int(5);default:0;comment:多选总数"`
	JudgmentQuestionCount     int    `json:"judgment_question_count" gorm:"type:int(5);default:0;comment:判断题总数"`
	ApplicationQuestionsCount int    `json:"application_questions_count" gorm:"type:int(5);default:0;comment:应用题总数"`
	PublicRange               string `json:"public_range" comment:"公开范围"`
	PublishRange              string `json:"publish_range" comment:"发布范围"`
	Status                    int    `json:"status" comment:"状态"`
	Count                     int    `json:"count" comment:"题目总数"`
	models.ModelTime
}

func (SysExercises) TableName() string {
	return "sys_exercises"
}

type SysQuestionBankReturn struct {
	models.Model
	Name string `json:"name" comment:"题库名称"`
	//Type          string `json:"type" comment:"类型"`
	Cover         string `json:"cover"`
	Subject       string `json:"subject" comment:"科目"`
	Count         int    `json:"count" comment:"练习题总数"`
	CompleteCount int    `json:"complete_count,omitempty" comment:"已完成题目数"`
	PublicRange   string `json:"public_range" comment:"公开范围"`
	PublishRange  string `json:"publish_range" comment:"发布范围"`
	Remark        string `json:"remark" comment:"开始答题，继续答题，暂无权限"`
	RemarkLabel   string `json:"remark_label" comment:"start,continue,no_auth"`
	CorrectRate   string `json:"correct_rate" comment:"正确率"`
}
type SysQuestionBankWare struct {
	models.Model
	QuestionBankId            int    `json:"question_bank_id"`
	Name                      string `json:"name"`
	QuestionBankWare          string `json:"question_bank_ware"`
	Pid                       int    `json:"pid"`
	Level                     int    `json:"level"`
	Sort                      int    `json:"sort"`
	Count                     int    `json:"count"`
	SingleChoiceCount         int    `json:"single_choice_count" gorm:"type:int(5);default:0;comment:单选总数"`
	MultipleChoiceCount       int    `json:"multiple_choice_count" gorm:"type:int(5);default:0;comment:多选总数"`
	JudgmentQuestionCount     int    `json:"judgment_question_count" gorm:"type:int(5);default:0;comment:判断题总数"`
	ApplicationQuestionsCount int    `json:"application_questions_count" gorm:"type:int(5);default:0;comment:应用题总数"`
	IsContainExercise         int    `json:"is_contain_exercise"`
	IsFree                    int    `json:"is_free"`
	IsShow                    int    `json:"is_show"`
}

func (s SysQuestionBankWare) TableName() string {
	return "sys_exercises_ware"
}

type QuestionBankWareTree struct {
	Id int `gorm:"-" json:"id"`
	//QuestionBankId    int                    `json:"question_bank_id" gorm:"-"`
	//Sort              int                    `json:"sort,omitempty" gorm:"-"`
	//IsShow            int                    `json:"is_show,omitempty"`
	//IsContainExercise int `json:"is_contain_exercise" gorm:"-"`
	//IsFree            int                    `json:"is_free" gorm:"-"`
	Name string `gorm:"-" json:"name"`
	//Url               string                 `json:"url,omitempty" gorm:"-"`
	//Pid               int                    `json:"pid,omitempty" gorm:"-"`
	Count    int                    `json:"count,omitempty"`
	Children []QuestionBankWareTree `gorm:"-" json:"children,omitempty"`
	Learned  bool                   `json:"learned" gorm:"-"`
}

type SysQuestionBankWareList struct {
	models.Model
}

func (s SysQuestionBankWareList) TableName() string {
	return "sys_exercises_ware"
}

type SysExercisesList struct {
	models.Model
	Name string `json:"name" comment:"题库名称"`
}

func (s SysExercisesList) TableName() string {
	return "sys_exercises"
}
